int cmp_int(const void* e1, const void* e2) {
	return *(int*)e1 - *(int*)e2;
}

int heightChecker(int* heights, int heightsSize) {
	int* ans = malloc(n * sizeof(int));
	memcpy(ans, heights, heightsSize * sizeof(int));
	qsort(ans, heightsSize, sizeof(int), cmp_int);
	int i = 0;
	int count = 0;
	for (i = 0; i < heightsSize; i++) {
		if (ans[i] != heights[i])
			count++;
	}
	return count;
}